Test Series - java script

Test Number 6/92

Q: A conditional expression is also called a _______________
A. Alternative to if-else
B. Immediate if
C. If-then-else statement
D. Switch statement
Solution: A conditional expression can evaluate to either True or False based on the evaluation of the condition. If the condition is true then the value following the operator is taken that’s why it is called immediate if.
Q: What is a block statement in JavaScript?
A. conditional block
B. block that contains a single statement
C. both conditional block and a single statement
D. block that combines multiple statements into a single compound statement
Solution: A block statement groups zero or more statements. In languages other than JavaScript, it is known as a compound statement. A statement block is a block that combines more than one statements into a single compound statement for ease.
Q: When an empty statement is encountered, a JavaScript interpreter __________
A. Ignores the statement
B. Prompts to complete the statement
C. Throws an error
D. Shows a warning
Solution: The JavaScript interpreter takes no action when it executes an empty statement. The empty statement is occasionally useful when you want to create a loop that has an empty body.
Q: The “var” and “function” are __________
A. Keywords
B. Declaration statements
C. Data types
D. Prototypes
Solution: The var and function are declaration statements—they declare or define variables and functions. These statements define identifiers (variable and function names) that can be used elsewhere in your program and assign values to those identifiers.
Q: The enumeration order becomes implementation dependent and non-interoperable if ___________
A. If the object inherits enumerable properties
B. The object does not have the properties present in the integer array indices
C. The delete keyword is never used
D. Object.defineProperty() is not used
Solution: In computer programming, an enumerated type (also called enumeration or enum) is a data type consisting of a set of named values called elements, members or enumerators of the type. The enumerator names are usually identifiers that behave as constants in the language.
Q:  What will be the output of the following JavaScript code?

Int a=1;
if(a>10)
{  
    document.write(10);  
} 
else
{
    document.write(a);  
}
A. 10
B. 0
C. 1
D. Undefined
Solution: The if else statement is a part of the javascript conditioning statements. The line of code inside the “if” statement is executed if the value passed to “if” is 1.
Q: What will be the output of the following JavaScript code?

int a=4;
int b=1;
int c=0;
If(a==b)
    document.write(a);
else if(a==c)
    document.write(a);
else
    document.write(c);
A. 4
B. 1
C. 2
D. 0
Solution: For checking more than one condition the if else if loop is used. It is the extension of if else loop which is also sometimes known as if else ladder.
Q: 
A. 
B. 
C. 
D. 
Solution: 
Q: 
A. 
B. 
C. 
D. 
Solution: 

You Have Score    /9